package com.sjf.day01;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author <sjf753@qq.com>
 * @since 2021/12/2 13:31
 **/
public class Main {

    public static final Map<Object, Object> map = new HashMap<> (101);

    public static void main ( String[] args ) throws InterruptedException {

        Thread t1 = new Thread () {
            @Override
            public void run () {
                for ( int i = 0 ; i < 50 ; i++ ) {
                    map.put (String.valueOf (i) , String.valueOf (i));
                }
            }
        };

        Thread t2 = new Thread () {
            @Override
            public void run () {
                for ( int i = 50 ; i < 100 ; i++ ) {
                    map.put (String.valueOf (i) , String.valueOf (i));
                }
            }
        };

        t1.start ();
        t2.start ();

        Thread.sleep (10000);

        Set<Object> set = map.keySet ();
        for ( Object o : set ) {
            System.out.println ("k=" + o + "," + "v=" + map.get (o));
        }
    }

}